package guoanmaker.provider.business.controller;

import io.swagger.annotations.ApiOperation;
import guoanmaker.provider.business.model.PersonalDomainName;
import guoanmaker.provider.business.service.PersonalDomainNameinterface;
import guoanmaker.provider.helper.common.AjaxJson;
import guoanmaker.provider.helper.common.abstractobj.ApiController;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;



@RestController
@RequestMapping(ApiController.COMMODITY_URL)
public class PersonalDomainNameController {
	
	@Autowired
	private PersonalDomainNameinterface  personalDomainNameinterface;
	
	
	@ApiOperation(value="查询域名信息",notes="查询域名信息")
	@PostMapping("/selectPersonalDomainName")
	public AjaxJson selectPersonalDomainName(){
		AjaxJson ajaxJson=new AjaxJson();
		try {
			ajaxJson.setSuccess(true).setStatus(200).setData(personalDomainNameinterface.selectPersonalDomainName());
		} catch (Exception e) {
			// TODO: handle exception
			e.printStackTrace();
			ajaxJson.setSuccess(true).setStatus(250).setData("查询失败");
		}
		return ajaxJson;
		
	}
	
	@ApiOperation(value="新增域名信息",notes="新增域名信息")
	@PostMapping("/insertPersonalDomainName")
	public AjaxJson insertPersonalDomainName(@RequestBody PersonalDomainName personalDomainName ){
		AjaxJson ajaxJson=new AjaxJson();
		ajaxJson.setSuccess(true).setStatus(200).setData(personalDomainNameinterface.insertPersonalDomainName(personalDomainName));
		return ajaxJson;
		
		
	}
}
